package com.pi.base.encrypt;

import java.nio.charset.Charset;


/**
 * 服务器接口加密解密类
 * 加密解密秘钥：xlmfbbjlmyxc
 * @author zoumy
 *
 */
public class CodeUtil {
	public static final String CODE_KEY = "xlmfbbjlmyxc";
	private static final Charset charset = Charset.forName("UTF-8");
	private static byte[] KEY_Bytes = CODE_KEY.getBytes(charset);  
	
	  /**
	   * 加密
	   * @param value   需要加密的字符串
	   * @return
	   */
	  public static String encode(String value){		
	  	byte[] str = value.getBytes(charset);
	  	for(int i=0;i<str.length;i++){
	  		str[i] ^=KEY_Bytes[i%KEY_Bytes.length];
	  	}
	  	return  new String(str);
	  }

}
